<?php
/*
 *      oschoiceform.php
 *      
 *      Copyright 2010 Vitaliy Rakitin <virak@ukr.net>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

require_once($_SERVER['DOCUMENT_ROOT']."/classes/GUI/nwfeditor.php");
require_once($_SERVER['DOCUMENT_ROOT']."/classes/System/nwform.php");
require_once($_SERVER['DOCUMENT_ROOT']."/classes/system.php");
require_once($_SERVER['DOCUMENT_ROOT']."/classes/GUI/nwmsg.php");
 
class oschoiceform extends nwform {
	
	private $object;
	private $dataset;
	private $form;
	
	function __construct($object) {
		parent::__construct();
		$this->object = &$object;
		$this->caption = $this->object->name." - Выбор";
		$this->body = $this->defaultbody();
	}
	
	function close() {
		parent::close();
	}
	
	function show($form) {
		$this->form = &$form;
		parent::show();
	}
	
	function choice() {
		//new nwmsg($this->object->select);
		//new nwmsg(print_r($this->form,1));
		$this->form->change($this->object->select);
		$this->close();
	}
	
	function defaultbody() {
		$out = "<input type='button' name='choice' value='choice' onclick=message('$this->uuid','choice','',0);>";
		$nwfeditor = new nwfeditor(genuuid(), $this->object);
		$out .= $nwfeditor->get();
		$osguitable = new osguitable(genuuid(), $this->object);
		$out .= $osguitable->get();
		return $out;
	}
}
?>

